package cn.edu.scau.cmi.zeyang.controller;

import java.net.URL;
import java.util.ResourceBundle;

import cn.edu.scau.cmi.zeyang.domain.insurance.Insurance;
import cn.edu.scau.cmi.zeyang.factory.FactoryController;
import javafx.collections.FXCollections;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.ChoiceBox;
import javafx.scene.control.TextArea;

public class FactoryModuleController {

	@FXML
	private Button button;

	@FXML
	private ChoiceBox<String> choiceBox;

	@FXML
	private TextArea textArea;

	public void initialize() {
		choiceBox.setValue("司机受伤");
		choiceBox.setItems(FXCollections.observableArrayList("司机受伤","汽车损坏","人员伤亡","多种事故"));
		textArea.setDisable(true);
		button.setOnAction(e -> {
			Insurance insurance = FactoryController.getInsurance(choiceBox.getValue());
			if (insurance != null)
				textArea.setText(insurance.getDetail());
			else
				textArea.setText("选择保险类型错误");
		});
	}

}
